let html = ''
let imgarr = [{
        img: './assets/images/ic_search.png'
    },
    {
        img: './assets/images/ic_cu.png'
    },
    {
        img: './assets/images/ic_coudanpin.png'
    },
    {
        img: './assets/images/ic_bcj.png'
    },
    {
        img: './assets/images/haitao.png'
    },
    {
        img: './assets/images/ic_temai.png'
    },
    {
        img: './assets/images/ic_trend.png'
    },
    {
        img: './assets/images/gengduo.png'
    },
    {
        img: './assets/images/ic_coudanpin.png'
    },
    {
        img: './assets/images/ic_kb.png'
    },
    {
        img: './assets/images/ic_mall.png'
    },
    {
        img: './assets/images/ic_pp.png'
    }


]
$.ajax({
    url: 'http://chst.vip:1234/api/getindexmenu',
    success(res) {
        let newimg = res.result.map((items, index) => {
            return {
                titlehref: items.titlehref,
                name: items.name,
                img: imgarr[index].img
            }
        });
        newimg.forEach((items, index) => {
            html += `<div class="col-xs-3">
                <a href="./pages/${items.titlehref}"><span><img src="${items.img}" alt=""></span></a>
                <p>${items.name}</p>
            </div>`
        });
        //console.log(html);
        let dv = $('.row')
        dv.html(`${html}`)
    },
    error() {},
})
$.ajax({
    url: 'http://chst.vip:1234/api/getmoneyctrl',
    success(res) {
        let html = ''
        console.log(res);
        res.result.forEach((items, index) => {
            html += ` <li class='clear'>
            <a href="indexXiang.html?productid=${items.productId}" class="clear">
                <div class="img fl">
                    ${items.productImgSm}
                </div>
                <div class="infoR">
                    <div class="title">
                        <h4>
                            ${items.productName}
                            <span>${items.productPinkage}</span>
                         </h4>
                    </div>
                    <div class="other">
                        <span class="mall fl">${items.productFrom} | ${items.productTime}</span>
                        <em class='fr'>
                            <i class="iconfont icon-pinglun fr"></i>
                        <span>${items.productComCount}</span>
                        </em>
                    </div>
                </div>
            </a>
        </li>`

        })
        $('.info').html(`${html}`)

    }
})
$('.footrow>a:nth-last-of-type(1)').click(function (e) {
    e.preventDefault()
    $('html,body').animate({
        scrollTop: 0
    },1500)
})